console.clear();
import type { RemoteAwardData } from '../../shares/sharesApp';
import './screenScale';
import './adminUI';

import hall, { HallButton } from './hall/App';
const hallButton = new HallButton(ui);
hallButton.onClick(() => {
    switch (hallButton.button.textContent) {
        case '作品展厅':
            hall.show();
            hallButton.button.textContent = '返回游戏';
            break;
        case '返回游戏':
            hall.hide();
            hallButton.button.textContent = '作品展厅';
            break;
    }
});

import award from './award/App';

remoteChannel.events.on('client', (event: RemoteAwardData) => {
    const { type, data } = event;
    if (type === 'award') {
        console.log('award', JSON.stringify(data));
        if (
            typeof data === 'object' ||
            (typeof data === 'number' && data >= 0) ||
            typeof data === 'string'
        ) {
            award.show(data);
        } else {
            award.hide();
        }
    }
});

// const screenUi = UiScreen.getAllScreen().find(e => e.name === 'screen');

remoteChannel.events.on('client', (args) => {
    if (args.type === 'ping') {
        remoteChannel.sendServerEvent({ type: 'ping', data: args.data });
    }
});
